﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 观测者模式_解耦实践2
{
    abstract class Observer
    { 
        protected string name;
        protected Subject s;

        public Observer(string name,Subject s)
        {
            this.s = s;
            this.name = name;
        }

        public abstract void Update();
    }


    class StockObserver : Observer
    {
        public StockObserver(string name,Subject s)  :base(name, s)
        {
            
        }

        public override void Update()
        {
            Console.WriteLine("{0}, {1}关掉股票网站", s.Subjectstate, name);
            Console.WriteLine();
        }
    }

    class NBAObserver : Observer
    { 
        public NBAObserver(string name,Subject s)  :base(name, s)
        {
            
        }

        public override void Update()
        {
            Console.WriteLine("{0}, {1}关掉NBA直播", s.Subjectstate, name);
            Console.WriteLine();
        }    
    }
}
